﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="query.aspx.cs" Inherits="AnyOffice.general.sms.query" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>短信查询</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<link rel="stylesheet" type="text/css" href="/module/date_selector/popcalendar.css">
		<script src="/module/date_selector/popcalendar.js"></script>
		<script src="/aspnet_client/core/function.js"></script>
		<script language="JavaScript">                             
             
 function CheckAll( checkAllBox )                         
 {                                                                  
 var frm = document.Form1;                               
  var ChkState=checkAllBox.checked;                   
  for(i=0;i< frm.length;i++)                                 
  {                                                                 
         e=frm.elements[i];                                   
        if(e.type=='checkbox' && e.name.indexOf('SmsId') != -1)
            e.checked= ChkState ;                        
  }                                                               
 }                                                                
                           
function CheckChanged()                                   
{                                                                   
  var frm = document.Form1;                              
  var boolAllChecked;                                         
  boolAllChecked=true;                                       
  for(i=0;i< frm.length;i++)                                 
  {                                                                 
    e=frm.elements[i];                                        
  if ( e.type=='checkbox' && e.name.indexOf('SmsId') != -1 )
      if(e.checked== false)                                  
      {                                                             
         boolAllChecked=false;                               
         break;                                                    
      }                                                              
  }                                                                  
  for(i=0;i< frm.length;i++)                                  
  {                                                                  
    e=frm.elements[i];                                         
    if ( e.type=='checkbox' && e.name.indexOf('checkAll') != -1 )
    {                                                            
      if( boolAllChecked==false)                         
         e.checked= false ;                                
         else                                                    
         e.checked= true;                                  
      break;                                                    
    }                                                             
   }                                                              
 }                                                                
	
function CheckForm()
{
   if(!(checkIsDate(document.Form1.txtBeginDate.value) || checkIsDateTime(document.Form1.txtBeginDate.value)))
   {
	 alert("起始日期不正确！");
	 document.Form1.txtBeginDate.focus();
	 return (false);
   }
   
   if(!(checkIsDate(document.Form1.txtEndDate.value) || checkIsDateTime(document.Form1.txtEndDate.value)))
   {
	 alert("截止日期不正确！");
	 document.Form1.txtEndDate.focus();
	 return (false);
   }
   return (true);
}

function delete_sms()
{
	var checkNums=0;
	var checkList = document.getElementsByTagName("input");
	for(i=0;i<checkList.length;i++)
	{
		if((checkList[i].type == "checkbox") && (checkList[i].id != "checkAll"))
		{
			if(checkList[i].checked)
				checkNums++;
		}
	}
	
	if(checkNums==0)
	{
		alert("要删除短信，请至少选择其中一条。");						
		return false;
	}
	
	msg='确认要删除所选短消息么？';
	if(window.confirm(msg))
		return true
	else
		return false;
}

		</script>
	</HEAD>
	<body class="bodycolor" style="padding-top:0;">
		<form id="Form1" method="post" runat="server">
         <div class="main_div">
			<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
				<tr>
					<td class="tab_ti"><asp:Literal id="litNavTitle" runat="server"></asp:Literal>
					</td>
				</tr>
			</table>			
			<asp:Panel id="pnlMain" runat="server">
				<TABLE width="500" cellSpacing="0" cellPadding="0" border="0" class="tab_pub" align="center">
					<TR>
						<TD class="ta_bg" noWrap>
							<SELECT id="selectType" name="selectType" runat="server"  class="BigSelect">
								<OPTION value="FROM_ID" selected>发送人</OPTION>
								<OPTION value="TO_ID">收信人</OPTION>
							</SELECT>
						</TD>
						<TD class="ta_txt"><INPUT class="BigStatic fl" id="ToName" readOnly type="text" name="Text1" runat="server">
							<INPUT class="bnt_Add fl" style="width:50px; display:inline-table;" title="添加用户" onClick="user_single('ToId','ToName')" type="button" value="添加"
								name="button"><INPUT class="bnt_Del fl" style="width:50px; display:inline-table;" title="清空用户" onClick="clear_double('ToId','ToName')" type="button" value="清空"
								name="button"><INPUT id="ToId" type="hidden" name="ToId" runat="server">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>起始日期：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtBeginDate" type="text" maxLength="20" size="20" name="txtBeginDate"
								runat="server"> <IMG style="CURSOR: hand" onClick="popUpCalendar(this,txtBeginDate,'yyyy-mm-dd','');"
								src="/module/date_selector/calendar.gif" align="absMiddle" border="0"> <IMG style="CURSOR: hand" onClick="popClock('txtBeginDate');" src="/images/menu/clock.gif"
								align="absMiddle" border="0">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>截止日期：</TD>
						<TD class="ta_txt"><INPUT class="BigInput" id="txtEndDate" type="text" maxLength="20" size="20" name="txtEndDate"
								runat="server"> <IMG style="CURSOR: hand" onClick="popUpCalendar(this,txtEndDate,'yyyy-mm-dd','');" src="/module/date_selector/calendar.gif"
								align="absMiddle" border="0"> <IMG style="CURSOR: hand" onClick="popClock('txtEndDate');" src="/images/menu/clock.gif"
								align="absMiddle" border="0">
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>发送时间：</TD>
						<TD class="ta_txt"><SELECT id="selectSeq" name="selectSeq" runat="server" class="BigSelect">
								<OPTION value="DESC" selected>降序</OPTION>
								<OPTION value="ASC">升序</OPTION>
							</SELECT></TD>
					</TR>
					<TR>
						<TD class="bnt_con" noWrap align="center" colSpan="2">
							<asp:Button id="btnSubmit" runat="server" Text="查 询" CssClass="bnt01" ToolTip="进行查询" onclick="btnSubmit_Click"></asp:Button></TD>
					</TR>
				</TABLE>
			</asp:Panel>
			<asp:Panel id="pnlQuery" runat="server" Visible="False">
			<br>
				<TABLE width="95%" cellSpacing="0" cellPadding="0" border="0" class="tab_pub" align="center">
					<TR class="TableHeader">
						<TD noWrap align="center">选择</TD>
						<TD noWrap align="center">类别</TD>
						<TD noWrap align="center"><asp:Literal id="litUserType" runat="server"></asp:Literal></TD>
						<TD noWrap align="center" width="50%">内容</TD>
						<TD noWrap align="center">发送时间</TD>
						<TD noWrap align="center">提醒</TD>
					</TR>
					<asp:Repeater id="rptSms" runat="server">
						<ItemTemplate>
								<TR class="TableLine1">
								<TD noWrap align="center">
									<INPUT id="SmsId" onclick=CheckChanged(); type=checkbox value='<%#Eval("SmsId")%>' runat="server" NAME="Checkbox1">
								</TD>
								<TD align="center"><!-- 如果为个人短信则显示个性头像-->
								<IMG title="<%#Eval("CodeName")%>" src="/images/<%# (Convert.ToInt32(Eval("Type").ToString()) == 0)?("avatar/" + Eval("Avatar").ToString()):("sms_type" + Eval("Type").ToString()) %>.gif">
								</TD>
								<TD noWrap align="center"><%#Eval("UserName")%></TD>
								<TD><%#Eval("Content")%></TD>
								<TD noWrap align="center"><%#Eval("SendTime")%></TD>
								<TD noWrap align="center">
								<%# (Convert.ToBoolean(Eval("RemindFlag").ToString()) == true)?"是":"否"%></TD>
							</TR>
						</ItemTemplate>
						<AlternatingItemTemplate>
							<TR class="TableLine2">
								<TD noWrap align="center">
									<INPUT id="SmsId" onclick=CheckChanged(); type=checkbox value='<%#Eval("SmsId")%>' runat="server" NAME="Checkbox1">
								</TD>
								<TD align="center"><!-- 如果为个人短信则显示个性头像-->
								<IMG title="<%#Eval("CodeName")%>" src="/images/<%# (Convert.ToInt32(Eval("Type").ToString()) == 0)?("avatar/" + Eval("Avatar").ToString()):("sms_type" + Eval("Type").ToString()) %>.gif">
								</TD>
								<TD noWrap align="center"><%#Eval("UserName")%></TD>
								<TD><%#Eval("Content")%></TD>
								<TD noWrap align="center"><%#Eval("SendTime")%></TD>
								<TD noWrap align="center"><%# (Convert.ToBoolean(Eval("RemindFlag").ToString()) == true)?"是":"否"%></TD>
							</TR>
						</AlternatingItemTemplate>
					</asp:Repeater>
					<TR class="TableControl">
						<TD colSpan="9">&nbsp;&nbsp; <INPUT id="checkAll" onClick="CheckAll(this);" type="checkbox" name="checkAll">&nbsp;&nbsp;全选&nbsp;&nbsp;
						<asp:Button id="btnDelete" runat="server" Text="删除" CssClass="SmallButton" onclick="btnDelete_Click"></asp:Button>&nbsp;&nbsp;删除对方未读的短信后，对方将不会接收到							
						</TD>
					</TR>
				</TABLE>
				<BR>
				<CENTER>								
					<INPUT class="BigButton" onClick="location='query.aspx'" type="button" value="返回">
				</CENTER>
			</asp:Panel>
			<asp:Literal id="litMessage" runat="server"></asp:Literal>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
            </div>
		</form>
	</body>
</HTML>
